﻿@model List<Core_Category>
@{
    Layout = null;
    int cid = Convert.ToInt32(ViewBag.cid);
    //int.TryParse(Request.QueryString["id"], out cid);
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta charset="utf-8">
    <title>所有分类_花溆园艺植物商城</title>
    <link rel="stylesheet" href="\static\themes\xin\statics\css\ectouch.css">
</head>
<body style="max-width:640px;">
    <div id="loading"><img src="\static\themes\xin\statics\img\loading.gif"></div>
    <div class="con">
        <div class="category-top">
            <header>
                <section class="search">
                    <div class="text-all  text-all-back j-text-all">
                        <div class="input-text n-input-text i-search-input">
                            <a class="a-search-input j-search-input" href="javascript:void(0)"></a>
                            <i class="iconfont icon-sousuo"></i>
                            <input type="text" placeholder="请输入您搜索的关键词!">
                            <i class="iconfont icon-guanbi is-null j-is-null"></i>
                        </div>
                    </div>
                </section>
            </header>
        </div>	<aside>
            <div class="menu-left scrollbar-none" id="sidebar">
                <ul>
                    @for (int i = 0; i < Model.Count; i++)
                    {
                        var item = Model[i];

                        if (cid == 0 && i == 0)
                        {
                            cid = item.C_Id;
                            <li class="active"><a href="/main/category/@item.C_Id" title="@item.C_Title">@item.C_Title</a></li>
                        }
                        else if (cid > 0)
                        {
                            <li @($" class={(cid == item.C_Id ? "active" : "")}")><a href="/main/category/@item.C_Id" title="@item.C_Title">@item.C_Title</a></li>
                        }
                        else
                        {
                            <li><a href="/main/category/@item.C_Id" title="@item.C_Title">@item.C_Title</a></li>
                        }
                    }
                </ul>
            </div>
        </aside>
        <section class="menu-right padding-all j-content">
            @{
                var subCat = Model.Where(o => o.C_PId == cid);
                if (subCat.Any())
                {
                    <h5>@Model.First(o => o.C_Id == cid).C_Title</h5>
                    <ul>
                        @foreach (var coreCategory in subCat)
                        {
                            <li class="w-3">
                                <a href="/plants/index/@coreCategory.C_Id"></a>
                                <img src="@coreCategory.C_CoverImg" alt="@coreCategory.C_Title"><span>@coreCategory.C_Title</span>
                            </li>
                        }
                    </ul>
                }
            }
        </section>
    </div>
    <footer class="new-index-footer ">
        <ul class="dis-box new-footer-box">
            <li class="box-flex">
                <a href="/" class="nav-cont"><i class="nav-box"><img src="\static\themes\xin\statics\img\home.png"></i><span>首页</span></a>
            </li>
            <li class="box-flex">
                <a href="/main/category" class="nav-cont active"><i class="nav-box"><img src="\static\themes\xin\statics\img\cate-a.png"></i><span>分类</span></a>
            </li>
            <li class="box-flex"><a href="/plants/new" class="nav-cont"><i class="nav-box"><img src="\static\themes\xin\statics\img\new.png"></i><span>新品</span></a></li>
            <li class="box-flex"><a href="/plants/hot" class="nav-cont"><i class="nav-box"><img src="\static\themes\xin\statics\img\hot.png"></i><span>热卖</span></a></li>
        </ul>
    </footer>

    @{
        Html.RenderAction("PlantsFilter", "Main");
    }
    <script type="text/javascript" src="\static\themes\xin\statics\js\jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="\static\themes\xin\statics\js\swiper-3.2.5.min.js"></script>
    <script type="text/javascript" src="\static\themes\xin\statics\js\ectouch.js"></script>
    <script type="text/javascript">
        $(function ($) {
            $('#sidebar ul li').click(function () {
                $(this).addClass('active').siblings('li').removeClass('active');
                var index = $(this).index();
                $('.j-content').eq(index).show().siblings('.j-content').hide();
                $(window).scrollTop(0);
            })
        })

        function redirect_list(id) {
            localData.remove('cat_' + id + '_page');
            localData.remove('cat_' + id + '_page_min');
            localData.remove('cat_' + id + '_page_max');
            window.location.href = 'index.php?c=category&id=' + id;
        }
    </script>
</body>
</html>